/**
 * @file tone.h
 * @brief COSC361 - MCU Jukebox Project\n
 * Group: Hamish Cumming, Brian Thorne\n
 * Latest source can be obtained using SVN from google's code repository with the following command:\n
 * svn checkout http://mega8-hob.googlecode.com/svn/trunk/ jukebox-hamish-brian\n
 * Description: All sound related functions can be accessed from this header file\n
 * Date: 25/5/2008
 */

 

#ifndef tone_h
#define tone_h

/* All the notes on a keyboard! */
#define N_C7    89//4186.01
#define N_B7    95//3951.07
#define N_Bf7   100//3729.31
#define N_A7    106//3520.00
#define N_Af6   113//3322.44
#define N_G6    119//3135.96
#define N_Fs6   127//2959.96
#define N_F6    134//2793.83
#define N_E6    142//2637.02
#define N_Ef6   150//2489.02
#define N_D6    159//2349.32
#define N_Cs6   169//2217.46
#define N_C6    179//2093.00
#define N_B6    190//1975.53
#define N_Bf6   201//1864.66
#define N_A6    213//1760.00
#define N_Af5   255//1661.22
#define N_G5    239//1567.98
#define N_Fs5   253//1479.98
#define N_F5    268//1396.91
#define N_E5    284//1318.51
#define N_Ef5   301//1244.51
#define N_D5    319//1174.66
#define N_Cs5   338//1108.73
#define N_C5    358//1046.50
#define N_B5    379//987.767
#define N_Bf5   402//932.328
#define N_A5    425//880.000
#define N_Af4   451//830.609
#define N_G4    478//783.991
#define N_Fs4   506//739.989
#define N_F4    536//698.456
#define N_E4    568//659.255
#define N_Ef4   602//622.254
#define N_D4    637//587.330
#define N_Cs4   675//554.365
#define N_C4    716//523.251
#define N_B4    758//493.883
#define N_Bf4   803//466.164
#define N_A4    851//440.000
#define N_Af3   901//415.305
#define N_G3    955//391.995
#define N_Fs3   1012//369.994
#define N_F3    1072//349.228
#define N_E3    1136//329.628
#define N_Ef3   1203//311.127
#define N_D3    1275//293.665
#define N_Cs3   1351//277.183
#define N_C3    1431//261.626 //Middle C
#define N_B3    1516//246.942
#define N_Bf3   1606//233.082
#define N_A3    1702//220.000
#define N_Af2   1803//207.652
#define N_G2    1910//195.998
#define N_Fs2   2024//184.997
#define N_F2    2144//174.614
#define N_E2    2272//164.814
#define N_Ef2   2407//155.563
#define N_D2    2550//146.832
#define N_Cs2   2701//138.591
#define N_C2    2862//130.813
#define N_B2    3032//123.471
#define N_Bf2   3212//116.541
#define N_A2    3404//110.000
#define N_Af1   3606//103.826
#define N_G1    3820//97.9989
#define N_Fs1   4048//92.4986
#define N_F1    4288//87.3071
#define N_E1    4543//82.4069
#define N_Ef1   4813//77.7817
#define N_D1    5060//73.4162
#define N_Cs1   5403//69.2957
#define N_C1    5724//65.4064
#define N_Bf1   6065//61.7354
#define N_B1    6425//58.2705
#define N_A1    6807//55.0000
#define N_Af0   7212//51.9130
#define N_G0    7641//48.9995
#define N_Fs0   8095//46.2493
#define N_F0    8577//43.6536
#define N_E0    9087//41.2035
#define N_Ef0   9627//38.8909
#define N_D0    10199//36.7081
#define N_Cs0   10806//34.6479
#define N_C0    11448//32.7032
#define N_B0    11749//30.8677
#define N_Bf0   12850//29.1353
#define N_A0    13614//27.5000


/* Structs */
/**
 * @brief Represents a note
 */
typedef struct _tone 
{
    unsigned int frequency; //actually its a function of wavelength
    unsigned int duration;
} tone_t;

/**
 * @brief Represents a song with one track
 */
typedef struct _song
{
    int length;
    tone_t song[];
    
} song_t;

/* Prototypes */
void play_tone(tone_t tone);

#endif
